<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------

use think\Route;
/**
 * 当前开启了 “强制使用路由”， 当没有匹配到所有的路由规则后，会路由到 public/miss路由地址
 */
//公共
Route::resource(':version/app/Communal','api/:version.app.Communal');   //公共方法
Route::resource(':version/app/Crontab','api/:version.app.Crontab');   //定时器用
Route::resource(':version/app/UploadFile','api/:version.app.UploadFile');   //bas64多图片文件上传
//Route::resource(':version/cms/upload','api/:version.cms.Upload');   //视频等file上传

//cms
Route::group(':version/cms', function(){
    //登录
    Route::post('/token', 'api/:version.cms.Token/getToken');

    //管理端接口
    Route::get('/admin/menu','api/:version.cms.Admin/getMenuByAdmin');
    Route::get('/admin/basic','api/:version.cms.Admin/getBasicInfoByAdmin');
    Route::post('/admin/basic','api/:version.cms.Admin/setBasicInfoByAdmin');
    Route::post('/admin/password','api/:version.cms.Admin/setPasswordByAdmin');
    Route::post('/admin/password_default','api/:version.cms.Admin/setDefaultPassword');
    Route::post('/admin/condition','api/:version.cms.Admin/getAdminByCondition');

    //角色列表
    Route::get('/admin/role','api/:version.cms.AdminRole/index');
    Route::post('/admin/role','api/:version.cms.AdminRole/setRole');
    Route::get('/role/menu','api/:version.cms.AdminRole/getRoleMenuById');

    //菜单列表
    Route::get('/menu', 'api/:version.cms.AdminMenu/getMenuTree');
    Route::post('/menu', 'api/:version.cms.AdminMenu/setMenu');

    //公司介绍
    Route::get('/company/basic','api/:version.cms.About/getCompanyBasicInfo');
    Route::post('/company/basic','api/:version.cms.About/setCompanyBasicInfo');

    //小程序装修
    Route::get('/home/background','api/:version.cms.Applet/getHomeBackground');
    Route::post('/home/background','api/:version.cms.Applet/setHomeBackground');
    Route::get('/home/header','api/:version.cms.Applet/getAppletHeader');
    Route::post('/home/header','api/:version.cms.Applet/setAppletHeader');
    Route::get('/banner/list','api/:version.cms.Applet/getBannerList');
    Route::post('/banner','api/:version.cms.Applet/setBanner');

    //小区合伙人
    Route::post('/agency/condition','api/:version.cms.Agency/getAgencyByCondition');
    Route::post('/agency/apply/condition','api/:version.cms.Agency/getAgencyApplyByCondition');
    Route::post('/agency/apply/set','api/:version.cms.Agency/setAgencyApply');

    //商品
    Route::post('/product/category/set','api/:version.cms.Product/setProductCategory');
    Route::post('/product/category/edit','api/:version.cms.Product/editProductCategory');
    Route::get('/product/category/list','api/:version.cms.Product/getNormalProductCategoryList');
    Route::post('/product/category/condition','api/:version.cms.Product/getProductCategoryByCondition');
    Route::get('/product/appendix/list','api/:version.cms.Product/getNormalProductAppendixList');
    Route::post('/product/appendix/set','api/:version.cms.Product/setProductAppendix');
    Route::post('/product/comment/condition','api/:version.cms.Product/getProductCommentByCondition');
    Route::post('/product/comment/set','api/:version.cms.Product/setProductComment');
    Route::post('/product/condition','api/:version.cms.Product/getProductByCondition');
    Route::post('/product/set','api/:version.cms.Product/setProduct');
    Route::post('/product/status','api/:version.cms.Product/setProductStatus');
    Route::get('/product/sku','api/:version.cms.Product/getSkuByCode');
    Route::post('/product/sku', 'api/:version.cms.Product/setProductSku');
    Route::get('/product/property', 'api/:version.cms.Product/getPropertyByCode');
    Route::post('/product/property', 'api/:version.cms.Product/setProductProperty');
    Route::post('/product/stock', 'api/:version.cms.Product/setProductSkuStock');

    //上传图片
    Route::post('/upload','api/:version.cms.Upload/uploadToQiniuDefault');
});

//mini applet
Route::group(':version/applet', function(){
    Route::post('/agency/apply','api/:version.applet.Agency/getAgencyByCondition');
});



Route::miss('Error/index');